{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "e15fbd74-b2cb-40c7-bf6c-2026c512fee1",
   "metadata": {},
   "source": [
    "Chapter 05\n",
    "# 字符串和元组拆包、打包\n",
    "Book_1《编程不难》 | 鸢尾花书：从加减乘除到机器学习  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "a3b0b371-a969-461f-a11a-b197d9905e22",
   "metadata": {},
   "outputs": [],
   "source": [
    "list1 = [1, 2, 3, 4]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "0f0a9542-ba3f-44db-81e0-d09b874f9a2f",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 赋值，视图\n",
    "list2 = list1 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "70b61c38-ad17-4be7-9574-920e67cc7104",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 拷贝，副本 (浅拷贝)\n",
    "list3 = list1.copy()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "d78f824a-cece-4afb-a2ea-d6322029296b",
   "metadata": {},
   "outputs": [],
   "source": [
    "list2[0] = 'a'\n",
    "list2[1] = 'b'\n",
    "list3[2] = 'c'\n",
    "list3[3] = 'd'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "ee6d5b4b-09fb-4385-b89f-3ec2f7150e82",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['a', 'b', 3, 4]\n",
      "['a', 'b', 3, 4]\n",
      "[1, 2, 'c', 'd']\n"
     ]
    }
   ],
   "source": [
    "print(list1)\n",
    "print(list2)\n",
    "print(list3)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
